package com.xxx.mall.api;

import com.xxx.mall.response.R;
import com.xxx.mall.service.AttachFileGroupService;
import com.xxx.mall.vo.AttachFileGroupVO;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 邢晨旭
 * @since 2023-11-20
 */
@RestController
@RequestMapping("/attach_file_group")
public class AttachFileGroupApi {

    @Resource
    AttachFileGroupService attachFileGroupService;

    @GetMapping("/list")
    public R<List<AttachFileGroupVO>> list() {
        return R.ok(attachFileGroupService.queryList());
    }

    @PostMapping
    public R<Void> save(@RequestBody AttachFileGroupVO attachFileGroupVO) {
        attachFileGroupService.saveGroup(attachFileGroupVO);
        return R.ok();
    }

    @PutMapping
    public R<Void> update(@RequestBody AttachFileGroupVO attachFileGroupVO) {
        attachFileGroupService.updateGroup(attachFileGroupVO);
        return R.ok();
    }

    @DeleteMapping
    public R<Void> delete(@RequestParam Long attachFileGroupId) {
        attachFileGroupService.deleteById(attachFileGroupId);
        return R.ok();
    }

}
